package cn.edu.scau.cmi.zhengweibo.singleton;

import java.awt.List;
import java.util.ArrayList;

public class Marshal {
	private static Marshal marshal;
	private String name;
	
	private static ArrayList<Marshal> arrayList = new ArrayList<>(10);
	static int Number = 0;
	
	static {
		arrayList.add(  new  Marshal("朱德"));
		arrayList.add(  new  Marshal("彭德怀"));
		arrayList.add(  new  Marshal("林彪"));
		arrayList.add(  new  Marshal("刘伯承"));
		arrayList.add(  new  Marshal("贺龙"));
		arrayList.add(  new  Marshal("陈毅"));
		arrayList.add(  new  Marshal("罗荣桓"));
		arrayList.add(  new  Marshal("徐向前"));
		arrayList.add(  new  Marshal("聂荣臻"));
		arrayList.add(  new  Marshal("叶剑英"));
	}
	
	public String getName() {
		return name;
	}
	
	private Marshal(String name) {
		this.name=name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public static Marshal getInstance() {
		if (10 == Number) {
			return null;
		}
		Number++;
		return  arrayList.get(Number-1); 
	}
}
